package com.example.demo.system.configure;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor

public class ResultConfigure<T> {
    private Integer code;
    private String message;
    private T data;


    public static <T>ResultConfigure<T> success(){
        return new ResultConfigure<>(20000,"success",null);
    }
    public static <T>ResultConfigure<T> success(String message,T data){
        return new ResultConfigure<>(20000,message,data);
    }
    public static <T>ResultConfigure<T> success(T data){
        return new ResultConfigure<>(20000,"success",data);
    }
    public static <T>ResultConfigure<T> success(String message){
        return new ResultConfigure<>(20000,message,null);
    }
    public static <T>ResultConfigure<T> fail(){
        return new ResultConfigure<>(20001,"fail",null);
    }
    public static <T>ResultConfigure<T> fail(Integer code,String message){
        return new ResultConfigure<>(code,message,null);
    }
    public static <T>ResultConfigure<T> fail(Integer code){
        return new ResultConfigure<>(code,"fail",null);
    }
    public static <T>ResultConfigure<T> fail(String message){
        return new ResultConfigure<>(20001,message,null);
    }
}
